import unittest
import numpy as np
#from ardSerial import wrapper

balance=[0,  0,  0,  0,  0,  0,  0,  0, 30, 30, 30, 30, 30, 30, 30, 30,];


schedule = [['kbalance',2],\
            ['kbalance',4],\
            ['i',[8,25,12,40,9,40,13,20,11,40,15,20],1,],\
            ['i',[10,35,14,25,9,35,13,25,11,-5,15,90,],1.5],\
            ['i',[8,45,9,25,10,35,14,25,12,-70,13,35,11,-5,15,90,],0.8],\

            ['i',[8,-70,12,45,],0.8],\
            ['i',[8,-50,12,70,10,30,11,30,14,30,15,30,],0.8],\

            ['i',[9,45,13,0,10,25,14,35],0.8],\
            ['i',[8,-40,9,60,13,-75,10,20,14,50,11,25,15,35],0.8],\
            ['i',[8,-45,12,50,9,-60,13,35,10,35,11,35],0.8],\
            ['i',[9,-40,13,65,],0.8],\
            ['l',[0,0,0,0, 0,0,0,0, 40,40,50,50, 60,60,90,90],0.8],\

            ['i',[9,50,13,30,10,65,14,40, 11, 15, 15, 75],0.8],\

            ['i',[9,60,13,20,10,80,14,60, 11, 10, 15, 90],0.8],\

            ['i',[8,0,9,60,13,30,10,80,14,65, 11, 15, 15, 80],0.8],\

            ['i',[8,-15,12,50,9,60,13,70,11,35,15,55],0.8],\
            ['i',[8,0,12,30,9,55,13,55,10,125,11,40,15,60],0.8],\
            ['i',[10,115,14,-85],0.8],\
            ['i',[8,5,12,35,10,60,14,-60],0.8],\
            ['i',[9,70,10,60,14,-20,11,35,15,75],0.8],\
            ['i',[13,-30],0.8],\

            ['i',[9,-15,13,35],0.8],\
            
            ['i',[8,65,12,35,9,-10,13,30,10,80,14,-60,11,90,15,90],0.8],\

            ['i',[8,65,12,45,10,70,14,-45,11,125],0.8],\
            ['i',[11,60,15,-45],0.8],\
            ['kbalance',1],\
            ['kwk',1]

            # ['b',['b','10','255'],1],['d',2]
            ]

index = 0;
for task in schedule:
      #wrapper(task)
      #print(task[0])
      
      if task[0]=='i'or task[0]=='l':
            print("stepState"+str(index)+" = \\")
            if task[0]=='i':
                  for x in xrange(0,len(task[1]),2):
                        balance[task[1][x]]=task[1][x+1]
            elif task[0]=='l':
                  for x in xrange(0,len(task[1])):
                        balance[x]=task[1][x]
            print([0,0]+balance+['N'])
            index+=1
index = 0;
for task in schedule:
      #print(task[0])
      if task[0]=='i'or task[0]=='l':
            print("\"s"+str(index)+"\" \t: "+ "stepState"+str(index)+",\\")
            index+=1

index = 0;
print("const char* steps[] = {")
for task in schedule:
      #print(task[0])
      if task[0]=='i'or task[0]=='l':
            print("s"+str(index)+",")
            index+=1
print("};")
